// 页面路径：store/index.js
import Vue from "vue";
import Vuex from "vuex";
import persistence from "../js_sdk/uksir-vuex-uniapp-persistence/uksir-vuex-uniapp-persistence/index.js"; // 引入uniapp中vuex持久化插件
// console.log(persistence)

// 引入用户模块
import user from "./user";

// 引入地址模块
import address from "./address";

console.log(uni.getMenuButtonBoundingClientRect())

Vue.use(Vuex);
const store = new Vuex.Store({
  state: {
	num: 100,
    safeArea: uni.getSystemInfoSync().safeArea, // 获取系统信息
    bounding: uni.getMenuButtonBoundingClientRect() || {}, // 获取胶囊信息
    // 手机平台
    platform: uni.getSystemInfoSync().platform,
  },
  mutations:{
	  addNum(state) {
		  state.num++
	  }
  },
  modules: { user, address },
  plugins: [persistence()], // 使用 持久化插件  rabbit 本地存储中的key
  // plugins: [persistence("rabbit")], // 使用 持久化插件  rabbit 本地存储中的key
});
export default store;
